package com.sailfish.springbootdemo.controller.db1;

import com.sailfish.springbootdemo.pojo.Result;
import com.sailfish.springbootdemo.pojo.db1.PcbaSpecialResource;
import com.sailfish.springbootdemo.service.db1.PcbaSpecialResourceService;
import com.sailfish.springbootdemo.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/pcbaSpecialResource")
@CrossOrigin
public class PcbaSpecialResourceController {

    @Autowired
    private PcbaSpecialResourceService pcbaSpecialResourceService;

    @PostMapping("/getAllByDeviceTypeAndSearch")
    public Result getAllByDeviceTypeAndSearch(Integer pcbaCompanyId, Integer pcbaWorkshopId, Integer pcbaDeviceTypeId, Integer page, Integer pageSize, Integer status) {
        return pcbaSpecialResourceService.getAllByDeviceTypeAndSearch(pcbaCompanyId, pcbaWorkshopId, pcbaDeviceTypeId, page, pageSize, status);
    }

    @PostMapping("/deleteById")
    public Result deleteById(Integer pcbaSpecialResourceId) {
        return pcbaSpecialResourceService.deleteById(pcbaSpecialResourceId);
    }

    @PostMapping("/addOrUpdatePcbaSpecialResource")
    public Result addOrUpdatePcbaSpecialResource(@RequestBody String data) {
        return pcbaSpecialResourceService.addOrUpdatePcbaSpecialResource(data);
    }

    @PostMapping("/auditPcbaSpecialResource")
    public Result auditPcbaSpecialResource(Integer pcbaSpecialResourceId, String notes, Integer status) {
        return pcbaSpecialResourceService.auditPcbaSpecialResource(pcbaSpecialResourceId, notes, status);
    }
}
